{{indexmenu_n>27}}
====== SiteExport Config ======

Site Export is a pain. Don't use it.  Use Epub instead.

[[https://github.com/i-net-software/dokuwiki-plugin-siteexport#dokuwiki-site-export|README on github]]

The SiteExport Plugin is used to export the **User Manual** (compressed siteexport.zip with multiple page html & images). The Opencpn_User_Manual **TOC** page:

See **[[:opencpn:opencpn_user_manual:toc|opencpn:opencpn_user_manal:toc]]**

is used to provide a "hyperlinked page-by-page" **Table of Contents** which is required to export the User Manual.

==== IndexMenu Plugin Code to create the TOC ====

There is more information about configuration of the [[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual:edit_user_manual:test_navigation_toc|IndexMenu Plugin & TOC]] here, but the syntax and code we need in the TOC page to create the **Flat open TOC** is:

  CODE: {{indexmenu>:opencpn:opencpn_user_manual#5|msort nsort nojs skipns=/(opencpn:opencpn_user_manual:gallery_boats|opencpn:opencpn_user_manual:edit_user_manual|opencpn:opencpn_user_manual:toc|)/}}

Skip Namespaces parameter skipns=(ns|sn|ns)
   * gallery_boats
   * edit_user_manual
   * toc

See **[[opencpn:opencpn_user_manual:toc]]**   for the result.
 
To see this code, navigate to the OpenCPN Embedded User Manual TOC page above and use **DWedit** (right hand menu second button from the bottom to expose the code, you need edit rights). \\

 ==== Exporting Steps ====

  - Navigate to the OpenCPN User Manual **[[:opencpn:opencpn_user_manual:toc|TOC]]**.
  - **ADMIN > ADDITIONAL PLUGINS** (toward the bottom) **> SITE EXPORT**
  - Make sure the settings are [[opencpn:developer_manual:siteexport_config#configuration_settings_which_work]] as below. 
  - Select the "Method" from one of the three buttons. Each button gets assigned parameters from the configuration settings. They all result in a download of siteexport.zip to your PC.
      * **TOP**    - Direct Download Link
      * **MIDDLE** - wget Download URL 
      * **BOTTOM** - curl Download URL
  - Hit **SAVE**
  - It immediately starts "Adding "opencpn:developer_manual:vector_palette (10/73 pages)"
  - Blue stripes running across or it failed
  - Also you can hit "Update"


==== Configuration Settings which work ====

Except levels and Exclusion.
  - Note: Export of other Books is similar, but with the path changed.\\
  - Set Namespace: **opencpn:opencpn_user_manual:toc** <-Point to TOC! \\
  - Parent Namespace to export: **opencpn:opencpn_user_manual** <-Point to parent namespace!\\
  - Export Type: **Specified Depth**  or This Page, All Subnamespaces (but includes blank pages) \\
  - Depth: **5** \\
  - Export Linked Pages:**checked** <-Want linked html pages - is this what it does?
  - Export all parameters (eg. "do"): **checked** <-What the parameters & what does this do?
  - Render Engine: **ckgedit**   or dw2pdf, sitepdf, etc.
  - Export Template: **bootstrap3**
  - Use TOC in Namespace: **Not Checked** <-what is this used for?
  - Empty namespaces in TOC: **Not Checked** <-what is this used for?
  - Default Lang: **EN**
  - Disable JavaScript in Plugins: "un-checked"  <-better to leave it off if possible.
  - All other parameters are left not checked.

Information about "do" [[https://www.dokuwiki.org/devel:action_modes|Level:action_modes]]
different views...depends on render engine. \\
  export_raw: Export as wiki markup
  export_xhtml: Export as XHTML
  export_xhtmlbody: Export XHTML-body only
  check: Dumps some information about the users permissions and the DokuWiki setup.
[[https://www.dokuwiki.org/plugins?plugintype=8#extension__table|Extension Table - Render Engines]] \\

[[https://www.dokuwiki.org/export|DokuWiki Export]] \\
Configuration Please be sure the export action is not disabled. \\
You can specify the do parameter as an HTTP header called X-DOKUWIKI-DO, too. This may be useful for creating a static dump with a website spider.\\
  Example: wget -E -r http://wiki.foo.tld/doku.php?id=start -l 0 --header="X-DokuWiki-Do: export_xhtml"
  
==== Admin > Config down to SiteExport Settings which work ===

These are the settings which should be used in the **Admin > Config** down to SiteExport 
^ Parameter Description ^ Value |
| plugin export allowallusers | Checked |
|plugin siteexport default depth | 7 |
| plugin siteexport zipfilename | opencpn:siteexport.zip |
| plugin siteexport exclude | pdf zip 7z edit_user_manual blank cruisersforum gallery_boats place_view github |
| plugin siteexport max_execution_time | 2400 |
| plugin siteexport ignoreNon200 | checked |
| plugin siteexport ignoreAJAXError | checked |
| plugin siteexport debugLevel | Error |
| plugin siteexport debugFile | debug3.txt |
| plugin siteexport cachetime | 60*60*24 |
| plugin siteexport PDFHeaderPagebreak | 1 |
| plugin siteexport  seOddEven | not checked |
| plugin siteexport defaultAuthenticationUser | admin |
| plugin siteexport defaultAuthenticationPassword | blank |
| plugin siteexport useProxy | blank |
| plugin siteexport offSiteLinkTemplate | |
  

==== IndexMenu Plugin Code : Detail ====

To Export OpenCPN User Manual TOC  we want a non-expandable flat TOC with every page shown in proper order.

**%%{{indexmenu>:opencpn:opencpn_user_manual#5|msort nsort nojs}}%%**

  - Use the User Manual path ':opencpn:opencpn_user_manual'
  - Use '#6' to 'open' the tree down 6 levels.
  - Use 'msort' to sort pages by their meta tag indexmenu_n>N
  - Don't use 'navbar' because it is not needed. \\
  - Use 'nojs' Don't use javascript because tree is open. \\

==== Three Method Buttons above SAVE : Detail ====

**Top Button**  - %%https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn&addParams=1&defaultLang=en&depth=4&depthType=0.0&do=siteexport&ens=opencpn&exportLinkedPages=1&renderer=&template=bootstrap3%%

**Middle Button** - %%wget --max-redirect=4 --output-document=siteexport.zip --post-data="id=opencpn&addParams=1&defaultLang=en&depth=4&depthType=0.0&do=siteexport&ens=opencpn&exportLinkedPages=1&renderer=&template=bootstrap3" https://opencpn.org/wiki/dokuwiki/doku.php?id=doku.php --http-user=USER --http-passwd=PASSWD%%

**Bottom Button** - %%curl -L --max-redirs 4 -o siteexport.zip -d "id=opencpn&addParams=1&defaultLang=en&depth=4&depthType=0.0&do=siteexport&ens=opencpn&exportLinkedPages=1&renderer=&template=bootstrap3" https://opencpn.org/wiki/dokuwiki/doku.php?id=doku.php --anyauth --user USER:PASSWD%%

Then hit **SAVE**

==== It's not working : Where is the debug file? ====

Debugging must be activated from **ADMIN > CONFIG** and Browser file>"find" "siteexp" go down and change these parameters:

plugin»siteexport»debugFile \\
Debug File        **debug3.txt**

plugin»siteexport»zipfilename \\
Wiki Path and name for exported ZIP file  **opencpn:siteexport.zip**

plugin»siteexport»exclude \\
Pattern to exclude resources **.gov|favicon|advanced_chart_work|gshhshires**

=== NOTE @fetch.php to surpress error message === 

One problem to detect the error was that someone used the '@' symbol in

    fetch.php

to supress error message of

    file_get_contents()

So, no log entry was generated in the php_errors.log file.

IMHO: it would be better not to use the @ symbol, so debugging is more easy.


==== Use Media Manager to locate the Debug File ====

Then click on the **Home** button, from the dropdown button pick **Media Manager** 

**[[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn&do=media&ns=]]**

and look under the directories for **root** then look for the **debug.txt** file or in our case **debug3.txt**.  You can click on it to get it into the window, then click on the file name to download it. View it with something like NotePad++.  The last error will be at the end.

Each time SiteExport is used it leaves a file here, browse to root:opencpn directory. Use Media Manager to see

**[[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn&do=media&ns=debug3.txt]]**


==== Github Issues: During configuration ====

=== Export not working, and getting the index working correctly  ===

[[https://github.com/i-net-software/dokuwiki-plugin-siteexport#dokuwiki-site-export|README on github]]

[[https://github.com/i-net-software/dokuwiki-plugin-siteexport/issues/64]]

You could use a "toc" - page in the namespace. see https://github.com/i-net-software/dokuwiki-plugin-siteexport#table-of-contents-definition - With <toc merge> ... </toc> But you'd have to define the structure and every page by hand.

Ok, how do I eliminate the wiki shell and extra navigation menu?
Would that be resolved by a line by line "toc" of every page?
--This is a lot of work to make and maintain. I wonder if there is a script that could take the outline that we have for

%%{{indexmenu>:opencpn:opencpn_user_manual#1|js#drktheme navbar msort nsort}}%%

and just turn it into a line by line TOC?
@gamma

The look of your exported pages depends on your template. You will have to modify it or use a template that suits your needs. As for the TOC File: yeah, that would be nice. Not sure if "siteexportAGGREGATOR" (see documenation) could help here ...

Thanks, Ok,

    To eliminate the Wiki Shell and doubled left navigation : We would need to make a modified template and reference that template.
    How to turn the %% {{indexmenu ...}}%% navigation and sorting into a line by line TOC Ok I'll look at siteexportAggregator.

PS: I tried checking "Body only" in the Export Page configuration. I think that did the reverse of what I wanted, it kept the wiki shell. I want the Wiki Documentation only with navigation, I think.


=== After the Export ===

https://github.com/i-net-software/dokuwiki-plugin-siteexport/issues/73#event-987171098 \\
After Export the siteexport.zip contains:\\
..\lib\exe\css.php.t.bootstrap3.css \\
..\lib\exe\js.php.bootstrap3.js \\
..\lib\exe\opensearch.html \\

What do these files do? Why are they exported?  Is the css used by the exported html files? How do we exclude these files? I don't believe the plugin has access to these files.

These are "standard" files, linked in the meta header section. You can either **modify the template to exclude them** or you can **use the global exclude option** in the admin settings of the plugin.


=== Where is the Log File? Excluding stuff ===

https://github.com/i-net-software/dokuwiki-plugin-siteexport/issues/74#event-987173913

  * The log file is located in the media folder. In your case it should be the opencpn namespace.
  * Exclude can be a series of Regex Patterns, separated by spaces. Offsite references should not be exported but only linked - but they have to start with http/s, mailto:, javascript: or data:

https://github.com/i-net-software/dokuwiki-plugin-siteexport/issues/76#issuecomment-284311566
Exclude wildcard for all "blank" or "whatever...labeled" pages
Then a checkbox to exclude all empty directories, run after the "blank" pages are filtered

 try the global exclude option?

